#include <iostream>
#include <uv.h>
#include <stdio.h>
#include <unistd.h>
#include "ThreadImpl.h"

void start_thread(void *arg) {
  int track_len = *((int *) arg);
  while (track_len) {
    track_len--;
    printf("hare ran another step\n");
  }
  printf("hare done running!\n");
}

int main() {
  uv_loop_t *loop = uv_default_loop();

//  int len = 10;
//  uv_thread_t handle;
//  uv_thread_create(&handle, start_thread, &len);
//  pthread_detach((pthread_t)handle);

  std::cout << "main thread id:" << Thread::getThreadId() << std::endl;

  ThreadImpl thread;
  thread.start();

  sleep(2);

  printf("main done\n");

  return uv_run(loop, UV_RUN_DEFAULT);
}
